package com.markus.code.exam.aiqiyi;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Author:markusZhang
 * Date:Create in 2020/9/13 15:23
 * todo:
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()){
            String str = scanner.nextLine();
            Main demo = new Main();
            System.out.println(demo.process(str));
        }
    }
    private int process(String str){
        if (str == null || str.length() == 0){
            return 0;
        }
        int r = -1;
        Set<Character> set = new HashSet<>();
        int max = 0;
        char[] chars = str.toCharArray();
        for (int i=0;i<chars.length;i++){
            if (i != 0){
                set.remove(chars[i-1]);
            }
            while(r+1 < chars.length && !set.contains(chars[r+1])){
                set.add(chars[i]);
                r++;
            }
            max = Math.max(r-i+1,max);
        }
        return max;
    }
}
